<template>
  <div class="region">
    <div class="button">
      <div
        class="button-item"
        v-for="(item,index) in regionButton"
        :key="index"
        :class="[index==current?'button-active':'']"
        @click="toggle(index)"
      >{{item.content}}</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "CityRegion",
  data() {
    return {
      current: 0,
      regionButton: [{ content: "境内" }, { content: "境外·港澳台" }]
    };
  },
  methods: {
    toggle(index) {
      this.current = index;
    }
  }
};
</script>

<style lang="stylus" scoped>
@import '~@/assets/style/variables'

.region
  width: 100%
  height: 0.8rem
  background: $bgColor
  padding: 0.2rem 0
  .button
    margin: 0 auto
    display: flex
    flex-direction: row
    border: 0.02rem solid #fff
    border-radius: 0.05rem
    width: 5.46rem
    .button-item
      height: 0.4rem
      width: 2.73rem
      text-align: center
      line-height: 0.4rem
      color: #fff
    .button-active
      background: #fff
      color: $bgColor
</style>
